/* $RCSFile: DropDownListLangTemplate.cs $
 * Apache license v2 2011 by Christian Surieux
 * $Source: ?/ADNCRM.Core/UI/WebControls/DropDownListLangTemplate.cs $
 * $log$
 * Revision 6 2010/08/06 19:56:30  christian.surieux
 *   Added Log to All cs files
 */

using System;
using System.Globalization;
using System.Web.UI.WebControls;

namespace AddonNice.UI.WebControls
{
	public class DropDownListLangTemplate : System.Web.UI.ITemplate
	{
		CultureTypes cultureTypes;

        public DropDownListLangTemplate(CultureTypes types)
		{
			cultureTypes = types;
		}
		
		public void InstantiateIn(System.Web.UI.Control container)
		{
			DropDownList langList   =   new DropDownList();
			langList.Width          =   new Unit("140px", CultureInfo.InvariantCulture);
			langList.DataSource     =   CultureInfo.GetCultures(cultureTypes);
			langList.DataTextField  =   "DisplayName";
			langList.DataValueField =   "Name";
			container.Controls.Add(langList);
		}
	}
}